import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import fire from '@dfeidao/atom-web/msg/fire';

export default async function a005(fd: IFeidaoAiBrowserComponent) {
	// todo
	// const code = fd.data.node.querySelector<HTMLSpanElement>('[data-id="hidden_source1"]');
	// console.log(code.innerText);
	// const name = fd.data.node.querySelector<HTMLInputElement>('[data-id="hidden_name1"]');
	// code.innerHTML = data.hidden_source;// span设置值用innerHTML
	// name.value = data.hidden_name;
	const code = fd.data.node.querySelector<HTMLSpanElement>('[data-id="hidden_source1"]');
	const name = fd.data.node.querySelector<HTMLInputElement>('[data-id="hidden_name1"]');
	const info1 = { hidden_source: code.innerText, hidden_name: name.value };
	const info = get(fd, 'hidden_info') as { hidden_source: string, hidden_name: string };
	// const info1 = get(fd, 'old_info') as { hidden_source: string, hidden_name: string };
	// console.log(info1);
	// console.log("cccc" + info.hidden_source + info.hidden_name);
	if (info1) {
		fire('zj-000006', 'a001', 'edit', info1);
		// console.log(info);
		// alert("请选择数据");
	} else if (info) {
		// fire('zj-000006', 'a001');
		fire('zj-000006', 'a001', 'edit', info);
		// alert("请选择数据");
	} else {
		alert("请选择数据");
	}
}
